﻿USE [master]
GO
/****** Object:  Database [MXComponentApp]    Script Date: 07/21/2019 17:04:38 ******/
CREATE DATABASE [MXComponentApp] ON  PRIMARY 
( NAME = N'MXComponentApp', FILENAME = N'F:\MXComponentApp-master\DB\MXComponentApp.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'MXComponentApp_log', FILENAME = N'F:\MXComponentApp-master\DB\MXComponentApp_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [MXComponentApp] SET COMPATIBILITY_LEVEL = 100
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [MXComponentApp].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [MXComponentApp] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [MXComponentApp] SET ANSI_NULLS OFF
GO
ALTER DATABASE [MXComponentApp] SET ANSI_PADDING OFF
GO
ALTER DATABASE [MXComponentApp] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [MXComponentApp] SET ARITHABORT OFF
GO
ALTER DATABASE [MXComponentApp] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [MXComponentApp] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [MXComponentApp] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [MXComponentApp] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [MXComponentApp] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [MXComponentApp] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [MXComponentApp] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [MXComponentApp] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [MXComponentApp] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [MXComponentApp] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [MXComponentApp] SET  DISABLE_BROKER
GO
ALTER DATABASE [MXComponentApp] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [MXComponentApp] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [MXComponentApp] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [MXComponentApp] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [MXComponentApp] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [MXComponentApp] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [MXComponentApp] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [MXComponentApp] SET  READ_WRITE
GO
ALTER DATABASE [MXComponentApp] SET RECOVERY SIMPLE
GO
ALTER DATABASE [MXComponentApp] SET  MULTI_USER
GO
ALTER DATABASE [MXComponentApp] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [MXComponentApp] SET DB_CHAINING OFF
GO
EXEC sys.sp_db_vardecimal_storage_format N'MXComponentApp', N'ON'
GO
USE [MXComponentApp]
GO
/****** Object:  Table [dbo].[systemuser]    Script Date: 07/21/2019 17:04:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[systemuser](
	[userid] [int] IDENTITY(1,1) NOT NULL,
	[username] [nvarchar](50) NULL,
	[loginname] [nvarchar](50) NULL,
	[password] [nvarchar](50) NULL,
	[lastlogintime] [datetime] NULL,
	[createtime] [datetime] NULL,
	[creatby] [int] NULL,
	[updatetime] [datetime] NULL,
	[updateby] [int] NULL,
	[active] [int] NULL,
 CONSTRAINT [PK_user] PRIMARY KEY CLUSTERED 
(
	[userid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[systemuser] ON
INSERT [dbo].[systemuser] ([userid], [username], [loginname], [password], [lastlogintime], [createtime], [creatby], [updatetime], [updateby], [active]) VALUES (1, N'管理员', N'admin', N'123', NULL, CAST(0x0000AA8F00FD7070 AS DateTime), NULL, NULL, NULL, 1)
SET IDENTITY_INSERT [dbo].[systemuser] OFF
/****** Object:  Table [dbo].[materialwarehouse]    Script Date: 07/21/2019 17:04:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[materialwarehouse](
	[warehouseid] [int] NULL,
	[warehouseno] [int] NULL,
	[materialid] [int] NULL,
	[highspeed] [decimal](18, 2) NULL,
	[mediumspeed] [decimal](18, 2) NULL,
	[lowspeed] [decimal](18, 2) NULL,
	[beforeclose] [decimal](18, 2) NULL,
	[contacttime] [decimal](18, 2) NULL,
	[active] [int] NULL,
	[createtime] [datetime] NULL,
	[creatby] [int] NULL,
	[updatetime] [datetime] NULL,
	[updateby] [int] NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[material]    Script Date: 07/21/2019 17:04:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[material](
	[materialid] [int] IDENTITY(1,1) NOT NULL,
	[materialcode] [nvarchar](50) NULL,
	[materialname] [nvarchar](50) NULL,
	[materialdesc] [nvarchar](50) NULL,
	[materialunit] [nvarchar](50) NULL,
	[active] [int] NULL,
	[createtime] [datetime] NULL,
	[creatby] [int] NULL,
	[updatetime] [datetime] NULL,
	[updateby] [int] NULL,
 CONSTRAINT [PK_material] PRIMARY KEY CLUSTERED 
(
	[materialid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[formulahistory]    Script Date: 07/21/2019 17:04:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[formulahistory](
	[formulahistoryid] [int] IDENTITY(1,1) NOT NULL,
	[formulaid] [int] NULL,
	[plancount] [int] NULL,
	[realcount] [int] NULL,
	[createtime] [datetime] NULL,
 CONSTRAINT [PK_formulahistory] PRIMARY KEY CLUSTERED 
(
	[formulahistoryid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[formuladetailhistory]    Script Date: 07/21/2019 17:04:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[formuladetailhistory](
	[historyid] [int] IDENTITY(1,1) NOT NULL,
	[formulaid] [int] NULL,
	[warehouseid] [int] NULL,
	[planqty] [decimal](18, 2) NULL,
	[realqty] [decimal](18, 2) NULL,
	[createtime] [datetime] NULL,
 CONSTRAINT [PK_formuladetailhistory] PRIMARY KEY CLUSTERED 
(
	[historyid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[formuladetail]    Script Date: 07/21/2019 17:04:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[formuladetail](
	[formuladetailid] [int] IDENTITY(1,1) NOT NULL,
	[formulaid] [int] NULL,
	[warehouseid] [int] NULL,
	[planqty] [decimal](18, 2) NULL,
	[errorqty] [decimal](18, 2) NULL,
	[createtime] [datetime] NULL,
	[creatby] [int] NULL,
	[updatetime] [datetime] NULL,
	[updateby] [int] NULL,
 CONSTRAINT [PK_formuladetail] PRIMARY KEY CLUSTERED 
(
	[formuladetailid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[formula]    Script Date: 07/21/2019 17:04:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[formula](
	[formulaid] [int] IDENTITY(1,1) NOT NULL,
	[formulaname] [nvarchar](50) NOT NULL,
	[formuladesc] [nvarchar](250) NOT NULL,
	[active] [int] NULL,
 CONSTRAINT [PK_formula_1] PRIMARY KEY CLUSTERED 
(
	[formulaid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Default [DF_user_createtime]    Script Date: 07/21/2019 17:04:38 ******/
ALTER TABLE [dbo].[systemuser] ADD  CONSTRAINT [DF_user_createtime]  DEFAULT (getdate()) FOR [createtime]
GO
/****** Object:  Default [DF_user_active]    Script Date: 07/21/2019 17:04:38 ******/
ALTER TABLE [dbo].[systemuser] ADD  CONSTRAINT [DF_user_active]  DEFAULT ((1)) FOR [active]
GO
/****** Object:  Default [DF_materialwarehouse_active]    Script Date: 07/21/2019 17:04:38 ******/
ALTER TABLE [dbo].[materialwarehouse] ADD  CONSTRAINT [DF_materialwarehouse_active]  DEFAULT ((1)) FOR [active]
GO
/****** Object:  Default [DF_materialwarehouse_createtime]    Script Date: 07/21/2019 17:04:38 ******/
ALTER TABLE [dbo].[materialwarehouse] ADD  CONSTRAINT [DF_materialwarehouse_createtime]  DEFAULT (getdate()) FOR [createtime]
GO
/****** Object:  Default [DF_material_active]    Script Date: 07/21/2019 17:04:38 ******/
ALTER TABLE [dbo].[material] ADD  CONSTRAINT [DF_material_active]  DEFAULT ((1)) FOR [active]
GO
/****** Object:  Default [DF_material_createtime]    Script Date: 07/21/2019 17:04:38 ******/
ALTER TABLE [dbo].[material] ADD  CONSTRAINT [DF_material_createtime]  DEFAULT (getdate()) FOR [createtime]
GO
/****** Object:  Default [DF_formulahistory_createtime]    Script Date: 07/21/2019 17:04:38 ******/
ALTER TABLE [dbo].[formulahistory] ADD  CONSTRAINT [DF_formulahistory_createtime]  DEFAULT (getdate()) FOR [createtime]
GO
/****** Object:  Default [DF_formuladetailhistory_createtime]    Script Date: 07/21/2019 17:04:38 ******/
ALTER TABLE [dbo].[formuladetailhistory] ADD  CONSTRAINT [DF_formuladetailhistory_createtime]  DEFAULT (getdate()) FOR [createtime]
GO
/****** Object:  Default [DF_formuladetail_createtime]    Script Date: 07/21/2019 17:04:38 ******/
ALTER TABLE [dbo].[formuladetail] ADD  CONSTRAINT [DF_formuladetail_createtime]  DEFAULT (getdate()) FOR [createtime]
GO
/****** Object:  Default [DF_formula_active]    Script Date: 07/21/2019 17:04:38 ******/
ALTER TABLE [dbo].[formula] ADD  CONSTRAINT [DF_formula_active]  DEFAULT ((1)) FOR [active]
GO
